from decimal import Decimal
from datetime import datetime, date
from pydantic import BaseModel, ConfigDict, Field
from pydantic.alias_generators import to_camel
from typing import Optional
from module_admin.annotation.pydantic_annotation import as_query

class KlineBollModel(BaseModel):
    """
    股票k线boll表对应pydantic模型
    """
    model_config = ConfigDict(alias_generator=to_camel, from_attributes=True, populate_by_name=True)

    id: Optional[int] = Field(default=None, description='id')
    trade_date: Optional[date] = Field(default=None, description='交易日期')
    symbol: Optional[str] = Field(default=None, description='股票代码')
    open: Optional[Decimal] = Field(default=None, description='开盘价')
    close: Optional[Decimal] = Field(default=None, description='收盘价')
    low: Optional[Decimal] = Field(default=None, description='最低价')
    high: Optional[Decimal] = Field(default=None, description='最高价')
    upper: Optional[Decimal] = Field(default=None, description='上轨')
    middle: Optional[Decimal] = Field(default=None, description='中轨')
    lower: Optional[Decimal] = Field(default=None, description='下轨')
    bottom_divergence: Optional[bool] = Field(default=None, description='底背离信号')
    top_divergence: Optional[bool] = Field(default=None, description='顶背离信号')
    kline_period: Optional[str] = Field(default=None, description='周期')
    data_type: Optional[str] = Field(default=None, description='计算的数据类型')
    lower_type: Optional[str] = Field(default=None, description='比较低值的数据类型')
    upper_type: Optional[str] = Field(default=None, description='比较高值的数据类型')
    create_time: Optional[datetime] = Field(default=None, description='创建时间')
    update_time: Optional[datetime] = Field(default=None, description='更新时间')

class KlineBollQueryModel(KlineBollModel):
    """
    股票k线macd不分页查询模型
    """
    pass
